#include <stdio.h>
#include <stdlib.h>

int cmp(const void *a, const void *b) {
//    double *c, *d;
//    c = (double *) a;
//    d = (double *) b;
//    return *c > *d ? 1 : -1; //不是return *c-*d
    return *(double*)a > *(double *)b ? 1:-1;
}

int main() {
    double a[10] = {5, 2.5, 1.3, 3.2};
    int i, n = 4;
    qsort(a, n, sizeof(a[0]), cmp);
    for (i = 0; i < n; i++)
        printf("%.2f ", a[i]);
}
